Slides: Convolutional Neural Networks (20 min)#
Use Presentation mode.
Convolutions
Pooling
U-Net
Microscopy use cases
Teaching methods
import numpy as np
from IPython.display import HTML
from ttt_workshop_cnn import utils
Under the hood of CNNs#
# %matplotlib widget
smiley = utils.draw_smiley()
kernel = utils.draw_gaussian_kernel(size=3, sigma=1)
animation = utils.animate_convolution(smiley, kernel, interval=200)
HTML(animation.to_jshtml())
Note how the output is smaller than the input. This can be avoided using padding
Padding#
padded_smiley = np.pad(smiley, pad_width=1, mode='constant', constant_values=0)
padded_animation = utils.animate_convolution(padded_smiley, kernel, interval=200)
HTML(padded_animation.to_jshtml())
padded_smiley = np.pad(smiley, pad_width=1, mode='reflect')
padded_animation = utils.animate_convolution(padded_smiley, kernel, interval=200)
HTML(padded_animation.to_jshtml())
padded_smiley = np.pad(smiley, pad_width=1, mode='wrap')
padded_animation = utils.animate_convolution(padded_smiley, kernel, interval=200)
HTML(padded_animation.to_jshtml())